package mq.rabbit.common;

import com.rabbitmq.client.ConnectionFactory;
import org.junit.After;
import org.junit.Before;

import static mq.rabbit.common.config.RabbitMQ.*;

public class Base {

    protected ConnectionFactory connectionFactory;

    @Before
    public void init(){
        // 创建连接mq的连接工厂对象
        connectionFactory = new ConnectionFactory();
        // 设置连接mq主机
        connectionFactory.setHost(HOST);
        // 设置端口号
        connectionFactory.setPort(PORT);
        // 设置连接哪个虚拟主机
        connectionFactory.setVirtualHost(V_HOSTS);
        // 设置访问虚拟主机的用户名和密码
        connectionFactory.setUsername(USERNAME);
        connectionFactory.setPassword(PASSWORD);
    }

    @After
    public void destory(){

    }
}
